<?php

class Person {
  var $name; //var
  public $age;

   function say(){
    echo "helloworld,名字:$this->name,年龄:$this->age<br>";
  }

//测试传值
  function f1($id) {

  echo '-----<br>';

    var_dump($id);
  }


}

$p1=new Person;
$p1->name="张山";
$p1->age=10;

//echo($p1);
var_dump($p1);

$p1->f1(['id'=>'12']);












changeToArray($p1);


function changeToArray($obj) {

  $parameters = is_array($obj) ? $obj: [$obj];

          foreach ($parameters as $key => $parameter) {
              // if ($parameter instanceof UrlRoutable) {
              //     $parameters[$key] = $parameter->getRouteKey();
              // }
              echo "key:$key";

          }

          return $parameters;

}
